package cn.iocoder.yudao.module.member.service.praxisAnnex;

import cn.iocoder.yudao.module.member.controller.admin.praxisProject.vo.PraxisAnnexVO;
import cn.iocoder.yudao.module.member.dal.dataobject.praxisAnnex.PraxisAnnexDO;
import cn.iocoder.yudao.module.member.dal.mysql.praxisAnnex.PraxisAnnexMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;
import java.util.List;

/**
 * 项目附件 Service 实现类
 *
 * @author 管理员
 */
@Service
@Validated
public class PraxisAnnexServiceImpl implements PraxisAnnexService {

    @Resource
    private PraxisAnnexMapper praxisAnnexMapper;


    @Override
    public List<PraxisAnnexDO> getPraxisAnnexList(PraxisAnnexVO exportReqVO) {
        return praxisAnnexMapper.selectList(exportReqVO);
    }

    @Override
    public List<PraxisAnnexVO> getPraxisAnnexListByProjectId(Long relationId, Integer relationType) {
        return praxisAnnexMapper.getPraxisAnnexListByProjectId(relationId,relationType);
    }

    @Override
    public void batchSavePraxisAnnex(List<PraxisAnnexDO> list) {
        praxisAnnexMapper.insertBatch(list);
    }

    @Override
    public void deletePraxisAnnexByProjectId(Long relationId,Integer relationType){
        praxisAnnexMapper.delete(new QueryWrapper<PraxisAnnexDO>().eq("relation_id",relationId)
        .eq("relation_type",relationType));
    }
}
